  var totalPage =2;//一共多少页数据
  var pageSize =6;//每页显示10条数据
  var currentPage =1;//当前第几页数据，默认为1
  var isLoading = false;//是否正在加载更多数据//
$(function(){
	query(1);
	//票房查看
	function query(pageNum){
		var p={};
		p.pageSize=pageSize;
		 p.pageNum = pageNum;
		 $('#totalOrder-table').empty();
		 $('#totalOrder-table').append('<tr><td  hidden="true">主键号</td> <td>序号</td> <td>订单名称</td><td>总数量</td><td>总价</td></tr>');
	
			$.ajax({
				  type:"POST",
				  url:"/movie.front/orderController/getTotalTicketList",
				  data:JSON.stringify(p),
				  dataType:"json",
				  contentType:"application/json",
				  success:function(data){
		           array = data.result.list;
		           for(var i=0;i<array.length;i++){
		        	    var html = '' ;
		        		html = html+'<tr><td  hidden="true">'+array[i].id+'</td><td>'+(i+1)+'</td><td>'+array[i].orderName+'</td><td>'+array[i].totalQuantity+'</td><td>'+array[i].totalPrice+'</td></tr>';
		           	    $('#totalOrder-table').append(html); 
		           }
				   //总共多少页
		           $('#paginator').empty();
		           var totalPages = data.result.pages;
		        	   var pageHtml = '<ul>';
		        	   pageHtml =pageHtml+'<li class="m-pagination-page"><a herf="javascript:void(0);" id="firstPage" onclick="firstPagesquery(1)"> 首页 </a></li>';
		        	   for(var i=0;i<totalPages;i++){
		        		  pageHtml = pageHtml+'<li class="m-pagination-page"><a herf="javascript:void(0);" onclick="currentPagesquery('+(i+1)+')" id='+(i+1)+'>'+(i+1)+'</a></li>'; 
		        	   }
		        	   pageHtml =pageHtml+'<li class="m-pagination-page"><a herf="javascript:void(0);" id="endPage" onclick="endPagequery('+totalPages+')">尾页</a></li>';
		        	   pageHtml =pageHtml+'</ul>';
		        	   $('#paginator').append(pageHtml);
				  }
			
			   });
	}
			
	
});

//当前页
function currentPagesquery(currentId){
	 // alert(currentId);当前页码
	  $('#paginator').empty();
	     var p ={};
         p.pageSize = 6;
         p.pageNum = currentId;
         $('#totalOrder-table').empty();
		 $('#totalOrder-table').append('<tr><td  hidden="true">主键号</td> <td>序号</td> <td>订单名称</td><td>总数量</td><td>总价</td></tr>');
	
    $.ajax({
	  type:"POST",
	  url:"/movie.front/orderController/getTotalTicketList",
	  data:JSON.stringify(p),
	  dataType:"json",
	  contentType:"application/json",
	  success:function(data){
      array = data.result.list;
      if(currentId==1){
      for(var i=0;i<array.length;i++){
    	  var html = '' ;
    		html = html+'<tr><td  hidden="true">'+array[i].id+'</td><td>'+(i+1)+'</td><td>'+array[i].orderName+'</td><td>'+array[i].totalQuantity+'</td><td>'+array[i].totalPrice+'</td></tr>';
       	    $('#totalOrder-table').append(html); 
         }
      }
      else{
    	   for(var i=0;i<array.length;i++){
    		   var flag = (currentId-1)*6+i+1;
    		   var html = '' ;
    		   html = html+'<tr><td  hidden="true">'+array[i].id+'</td><td>'+flag+'</td><td>'+array[i].orderName+'</td><td>'+array[i].totalQuantity+'</td><td>'+array[i].totalPrice+'</td></tr>';
           	    $('#totalOrder-table').append(html); 
    	         }
      }
      
	   //总共多少页
      var totalPages = data.result.pages;
   	   var pageHtml = '<ul>';
   	   pageHtml =pageHtml+'<li class="m-pagination-page"><a herf="javascript:void(0);" id="firstPage" onclick="firstPagesquery(1)"> 首页 </a></li>';
   	   for(var i=0;i<totalPages;i++){
   		  pageHtml = pageHtml+'<li class="m-pagination-page"><a herf="javascript:void(0);" onclick="currentPagesquery('+(i+1)+')" id='+(i+1)+'>'+(i+1)+'</a></li>'; 
   	   }
   	   pageHtml =pageHtml+'<li class="m-pagination-page"><a herf="javascript:void(0);" id="endPage" onclick="endPagequery('+totalPages+')">尾页</a></li>';
   	   pageHtml =pageHtml+'</ul>';
   	   $('#paginator').append(pageHtml);
	  }

  });
}

//首页
function  firstPagesquery(firstPageId){
	currentPagesquery(firstPageId);
}

//尾页
function  endPagequery(endPageId){
	currentPagesquery(endPageId);
	 }
